]> dgit.raspbian.org Git - gnome-shell.git/commitdiff
ci: Print eslint results to stdout as well
authorFlorian Müllner <fmuellner@gnome.org>
Sat, 8 Jul 2023 11:06:05 +0000 (13:06 +0200)
committerMarge Bot <marge-bot@gnome.org>
Mon, 10 Jul 2023 10:19:34 +0000 (10:19 +0000)
The eslint jobs report their results as artifacts in junit format,
so that gitlab can present them in its UI.

However many people miss that, and unsuccessfully check the logs
instead.

Account for that by also printing the results to stdout.

Part-of: <https://gitlab.gnome.org/GNOME/gnome-shell/-/merge_requests/2829>

.gitlab-ci.yml
.gitlab-ci/run-eslint

index 87601aad4a4186b8694b0fd242ab685421a755fa..22e6e815cf642376aab1a473e3b5d26b76e9e681 100644 (file)
@@ -142,7 +142,7 @@ eslint:
   stage: review
   script:
     - export NODE_PATH=$(npm root -g)
-    - ./.gitlab-ci/run-eslint --output-file ${LINT_LOG} --format junit
+    - ./.gitlab-ci/run-eslint --output-file ${LINT_LOG} --format junit --stdout
   artifacts:
     reports:
       junit: ${LINT_LOG}
@@ -155,7 +155,7 @@ eslint_mr:
   stage: review
   script:
     - export NODE_PATH=$(npm root -g)
-    - ./.gitlab-ci/run-eslint --output-file ${LINT_MR_LOG} --format junit
+    - ./.gitlab-ci/run-eslint --output-file ${LINT_MR_LOG} --format junit --stdout
       --remote ${CI_MERGE_REQUEST_PROJECT_URL}.git
       --branch ${CI_MERGE_REQUEST_TARGET_BRANCH_NAME}
   only:
index 0d9fcf456cdd7ab4e47273d64f5aae658e642ad4..5d0e41c8e131ce3bced07b8ba1d69d1275d6d00d 100755 (executable)
@@ -81,6 +81,10 @@ async function getMergeRequestChanges(remote, branch) {
     return report;
 }
 
+function hasOption(...names) {
+    return process.argv.some(arg => names.includes(arg));
+}
+
 function getOption(...names) {
     const optIndex =
         process.argv.findIndex(arg => names.includes(arg)) + 1;
@@ -120,6 +124,11 @@ function getOption(...names) {
     if (outputPath) {
         fs.mkdirSync(path.dirname(outputPath), { recursive: true });
         fs.writeFileSync(outputPath, resultText);
+
+        if (hasOption('--stdout')) {
+            const consoleFormatter = await regular.loadFormatter();
+            console.log(consoleFormatter.format(commonResults));
+        }
     } else {
         console.log(resultText);
     }